package pers.kui.reader.task;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import pers.kui.reader.service.BookService;

import javax.annotation.Resource;

/**
 * @author liu
 * @date 2021/8/15
 * @apiNote
 */
// 完成自动计算工作
@Component
public class ComputeTask {
    @Resource
    private BookService bookService;

    // 任务调度
    @Scheduled(cron = "0 * * * * ?")
    public void updateEvaluation(){
        bookService.updateEvaluation();
        System.out.println("已更新所有图书评分");
    }
}
